package org.mat.ipaas.ucenter.bff.admin.modules.system;

import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.extern.slf4j.Slf4j;
import org.mat.framework.lang.dto.MatApiResponse;
import org.mat.ipaas.ucenter.service.api.system.SysDataLogRestAPI;
import org.mat.ipaas.ucenter.service.dto.system.entity.SysDataLogDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * 系统数据日志
 */
@RestController
@RequestMapping("/sys/dataLog")
@Slf4j
public class SysDataLogController {

	@Autowired
	private SysDataLogRestAPI sysDataLogRestAPI;
	
	@RequestMapping(value = "/list", method = RequestMethod.GET)
	public MatApiResponse<IPage<SysDataLogDTO>> queryPageList(SysDataLogDTO sysDataLogDTO, @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
															  @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, HttpServletRequest req) {
		MatApiResponse<IPage<SysDataLogDTO>> matApiResponse = sysDataLogRestAPI.queryPageList(sysDataLogDTO, pageNo, pageSize, req);
		return matApiResponse;
	}
	
	/**
	 * 查询对比数据
	 * @param req
	 * @return
	 */
	@RequestMapping(value = "/queryCompareList", method = RequestMethod.GET)
	public MatApiResponse<List<SysDataLogDTO>> queryCompareList(HttpServletRequest req) {
		MatApiResponse<List<SysDataLogDTO>> matApiResponse = sysDataLogRestAPI.queryCompareList(req);
		return matApiResponse;
	}
	
	/**
	 * 查询版本信息
	 * @param req
	 * @return
	 */
	@RequestMapping(value = "/queryDataVerList", method = RequestMethod.GET)
	public MatApiResponse<List<SysDataLogDTO>> queryDataVerList(HttpServletRequest req) {
		MatApiResponse<List<SysDataLogDTO>> matApiResponse = sysDataLogRestAPI.queryDataVerList(req);
		return matApiResponse;
	}
	
}
